package io.github.uicdb.et.block;

import lombok.RequiredArgsConstructor;
import net.minecraft.world.inventory.ContainerData;

@RequiredArgsConstructor
public class CombineContainerData implements ContainerData {
    final ContainerData dataA, dataB;

    @Override
    public int get(int i) {
        return i < dataA.getCount() ? dataA.get(i) : dataB.get(i - dataA.getCount());
    }

    @Override
    public void set(int i, int i1) {
        if (i < dataA.getCount()) {
            dataA.set(i, i1);
        } else
            dataB.set(i - dataA.getCount(), i1);
    }

    @Override
    public int getCount() {
        return dataA.getCount() + dataB.getCount();
    }
}
